package com.huangwei.service.impl;

import com.google.gson.Gson;
import com.huangwei.dao.DriverLicenseDao;
import com.huangwei.model.DriverLicense;
import com.huangwei.service.DriverLicenseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DriverLicenseServiceImpl implements DriverLicenseService {
    @Resource
    private DriverLicenseDao driverLicenseDao;

    @Override
    public int addDriverLicense(DriverLicense driverLicense) {
        try {
            return driverLicenseDao.add(driverLicense);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return -1;
    }

    @Override
    public int updateDriverLicense(DriverLicense driverLicense) {
        try {
            return driverLicenseDao.update(driverLicense);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return -1;
    }

    @Override
    public DriverLicense getOneDriverLicenseByID(int driverLicenseId) {
        try {
            return driverLicenseDao.queryOne(driverLicenseId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
